﻿using System;
using System.Collections.Generic;
using RssReader.Common;
using RssReader.DataModel;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;

namespace RssReader.FeedProvider
{
    public sealed class Item : BindableBase
    {
        public Item()
        {
            Links = new List<Link>();            
        }

        private string _title;
        public string Title {
            get
            {
                return _title;
            }
            set { this.SetProperty(ref this._title, value); }
        }

        public int Title_fontsize { get; set; }

        private DateTime _publishedOn;
        public DateTime Published_on {
            get
            {
                return _publishedOn;
            }

            set
            {
                this.SetProperty(ref this._publishedOn, value);
            }
        }

        private string _author;
        public string Author 
        {
            get
            {
                return _author;
            }
            set
            {
                this.SetProperty(ref this._author, value);
            }
        }

        private string _content;
        public string Content 
        {
            get
            {
                return _content;
            }
            set
            {
                this.SetProperty(ref this._content, value);
            }
        }

        private string _description;
        public string Description 
        {
            get
            {
                return _description;
            }
            set
            {
                this.SetProperty(ref this._description, value);
            }
        }

        private List<Link> _links;
        public List<Link> Links
        {
            get
            {
                return _links;
            }
            set
            {
                this.SetProperty(ref this._links, value);
            }
        }

        private Category _category;
        public Category Category
        {
            get { return _category; }

            set { this.SetProperty(ref this._category, value); }
        }
        private string _imagePath;

        public string Image_path
        {
            get
            {
                return _imagePath;
            }
            set
            {
                this.SetProperty(ref this._imagePath, value);
            }
        }
        public ImageSource Image_source
        {
            get
            {
                if (string.IsNullOrEmpty(Image_path)) return new BitmapImage(new Uri("ms-appx:///Assets/1xTransparent.png"));
                return new BitmapImage(new Uri(Image_path));
            }
        }

        public string Stackpanel_vertical_alignment 
        { 
            get
            {
                if (string.IsNullOrEmpty(Image_path)) return "Stretch";

                return "Bottom";
            } 
        }

        private string _height;
        public int Height { get; set; }
        public int Row_span { get; set; }
        private string _width;
        public int Column_span { get; set; }
    }
}
